﻿namespace Blaze.UI
{
    using UnityEngine;

    public static class UIMaterialUtility
    {
        /// <summary>
        /// 带Mask模版测试
        /// RGB + A
        /// </summary>
        public static Material Stand_AlphaSplit
        {
            get
            {
                if (mStand_AlphaSplit == null)
                {
                    mStand_AlphaSplit = new Material(Shader.Find("Blaze/UI/Standard"));

                    mStand_AlphaSplit.EnableKeyword("BLAZE_UI_ALPHASPLIT");
                }

                return mStand_AlphaSplit;
            }
        }

        /// <summary>
        /// 带Mask模版测试
        /// RGB + RBG.R(A)
        /// </summary>
        public static Material Stand_AplhaSplit_AutoETC1
        {
            get
            {
                if (mStand_AlphaSplit_AutoETC1 == null)
                {
                    mStand_AlphaSplit_AutoETC1 = new Material(Shader.Find("Blaze/UI/Standard"));

                    mStand_AlphaSplit_AutoETC1.EnableKeyword("BLAZE_UI_ALPHASPLIT");
                    mStand_AlphaSplit_AutoETC1.EnableKeyword("BLAZE_UI_ETC1COMPRESS");
                }

                return mStand_AlphaSplit_AutoETC1;
            }
        }

        /// <summary>
        /// 带Mask模版测试
        /// RGBA
        /// </summary>
        public static Material Stand
        {
            get
            {
                if (mStand == null)
                    mStand = new Material(Shader.Find("Blaze/UI/Standard"));

                return mStand;
            }
        }


        /// <summary>
        /// 不带Mask模版测试
        /// RGB + A
        /// </summary>
        public static Material FastStand_AlphaSplit
        {
            get
            {
                if (mFastStand_AlphaSplit == null)
                {
                    mFastStand_AlphaSplit = new Material(Shader.Find("Blaze/UI/FastStandard"));

                    mFastStand_AlphaSplit.EnableKeyword("BLAZE_UI_ALPHASPLIT");
                }
                
                return mFastStand_AlphaSplit;
            }
        }

        /// <summary>
        /// 不带Mask模版测试
        /// RGB + RGB.R(A)
        /// </summary>
        public static Material FastStand_AlphaSplit_AutoETC1
        {
            get
            {
                if (mFastStand_AlphaSplit_AutoETC1 == null)
                {
                    mFastStand_AlphaSplit_AutoETC1 = new Material(Shader.Find("Blaze/UI/FastStandard"));

                    mFastStand_AlphaSplit_AutoETC1.EnableKeyword("BLAZE_UI_ALPHASPLIT");
                    mFastStand_AlphaSplit_AutoETC1.EnableKeyword("BLAZE_UI_ETC1COMPRESS");
                }

                return mFastStand_AlphaSplit_AutoETC1;
            }
        }

        /// <summary>
        /// 不带Mask模版测试
        /// RGBA
        /// </summary>
        public static Material FastStand
        {
            get
            {
                if (mFastStand == null)
                    mFastStand = new Material(Shader.Find("Blaze/UI/FastStandard"));

                return mFastStand;
            }
        }


        private static Material mStand = null;
        private static Material mStand_AlphaSplit = null;
        private static Material mStand_AlphaSplit_AutoETC1 = null;

        private static Material mFastStand = null;
        private static Material mFastStand_AlphaSplit = null;
        private static Material mFastStand_AlphaSplit_AutoETC1 = null;
    }
}

